<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>User Registration</title>
    <link rel="stylesheet" href="../css/register.css">
</head>
<body>
<div id="app"  class="form-container" >

    <form>
        <label for="username">管理员名：</label>
        <input type="text" id="username" v-model="aname" required><br/>

        <label for="password">密码：</label>
        <input type="password" id="password" v-model="apwd" required><br/>

        <label for="phone">手机号:</label>
        <input type="text" id="phone" v-model="phone" >
        <button  type="button" @click="">获取验证码</button><br/>

        <button type="button" @click="register">注册</button>
<!--        <button @click="goToAnotherPage">已经有账号了</button>-->
        <a href="login.html">已经有账号了</a>
    </form>

</div>
<script src="../js/vue.js"></script>
<script src="../js/axios.js"></script>

<script>
    let app = new Vue({
        el: "#app",
        data: {
            aname: '',
            apwd: '',
            phone: '',
            // code: '',
        },
        methods:{
            //查询图书数据
            register(){
                var params = new URLSearchParams();
                params.append("aname",this.aname);
                params.append("apwd",this.apwd);
                params.append("phone",this.phone);
                axios.post("/Administrator_management_war/admin.action?op=register",params).then(  result =>{
                    let jm = result.data;
                    if ( jm.code==1 ){
                        alert("注册成功");
                        window.location.href = "login.html";
                    }else {
                        alert("注册失败");
                    }
                })
            },

        },
        computed:{

        }
    });
</script>
</body>
</html>